<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Seeder;
use Faker\Generator;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $faker = app(Generator::class);

        $rows = User::factory()->times(100)->make()->each(function ($row, $index) use ($faker) {
            $now = $faker->dateTimeBetween('-30 days');
            $row->created_at = $now;
            $row->updated_at = $now;
        });
        User::insert($rows->toArray());
    }
}
